/**
 * 交易记录页面
 */
import {
  getOrders,
} from '/common/api';

Page({
  data: {
    orders: [],
  },
  onShow() {
    getOrders()
      .then(({data: res}) => {
        if (res.message === 'success') {
          this.setData({
            orders: res.data,
          });
        } else {
          const { data: content } = res;
          my.showToast({
            type: 'fail',
            content,
          });
        }
      }).catch((err) => {
        console.log(err);
      });
  },
});
